package ua.kharkov.knure.dereza.summarytask4.db.dao;

import java.sql.Connection;
import java.sql.ResultSet;
import java.sql.Statement;
import java.util.List;

import ua.kharkov.knure.dereza.summarytask4.db.dto.LocaleDTO;

/**
 * Basic interface for all LocaleDAO
 * 
 * @author dereza
 * 
 */
public interface LocaleDAO {

	/**
	 * Returns a locale with the given id
	 * 
	 * @param locale
	 *            id
	 * @return LocaleDTO
	 */
	public LocaleDTO findLocaleById(int id);
	
	/**
	 * Returns a list of locales
	 * 
	 * @return List<LocaleDTO>
	 */
	public List<LocaleDTO> findAllLocales();
	
	/**
	 * Returns a id with the given locale name
	 * 
	 * @param locale
	 *            name
	 * @return LocaleDTO
	 */
	public LocaleDTO findLocaleByName(String name);

	/**
	 * Commits query and closes connection
	 * 
	 * @param rs
	 * @param ps
	 * @param conn
	 */
	public void commitAndClose(ResultSet rs, Statement ps, Connection conn);

	/**
	 * Rolls back the request
	 * 
	 * @param conn
	 */
	public void rollback(Connection conn);
}